package com.shelpe.services.lexicon.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import com.shelpe.services.lexicon.constants.Origin;
import com.shelpe.services.lexicon.constants.Status;
import com.shelpe.services.lexicon.entity.metrics.InsightMetrics;
import com.shelpe.services.lexicon.entity.metrics.RecommendMetrics;
import com.shelpe.services.lexicon.service.price.WordPricingRule.WordPricable;

import lombok.Getter;
import lombok.Setter;

@Document(collection = "keyword_recommends")
@Setter
@Getter
public class KeywordRecommend extends BaseEntity implements WordPricable{

	@Id
	private String recommendID;

	private String keywordID;
	private String word;

	private Origin origin = Origin.taobao;// 来源
	@Indexed
	private long adgroupID;// 推广编号，当来源为淘宝时有效
	@Indexed
	private String adgroupRecordID;

	private int weight;
	private RecommendMetrics metric;
	private InsightMetrics insight;
	private InsightMetrics mobileInsight;

	private Date tagSyncTime;
	private List<KeywordTag> tags;
	
	private Status status = Status.init;
	private Scope scope;

	private int performance;//性能
	private int pqr;//性价比
	private int productSimilarity;//相似度
	private int categorySimilarity;//相似度
	private int similarity;//相似度
	private int score;//得分
	private int price;//价格，以分为单位

	
	public KeywordRecommend(){}
	public KeywordRecommend(String word){
		this.word = word;
	}
	
	public void addTag(KeywordTag tag) {
		if (this.tags == null) {
			this.tags = new ArrayList<KeywordTag>();
		}
		this.tags.add(tag);
	}
}
